if (typeof accedo === "undefined") {
	accedo = {};
}
if (typeof accedo.memoryGame === "undefined") {
	accedo.memoryGame = {};
}
window.onload = function()	{
	accedo.memoryGame.mainPage.imageNode = document.getElementById("1"); 
//	alert(accedo.memoryGame.mainPage.imageNode.nodeName); 
	accedo.memoryGame.mainPage.imageNode.border = 3; 
	accedo.memoryGame.mainPage.imageNode.style.borderColor = "#FFFF00";
};

//deal with the keys down events
document.onkeydown = function(e) {
	accedo.memoryGame.mainPage.imageNode.border = 0; 
//	accedo.memoryGame.mainPage.imageNode.style.borderColor = "#FFFF00";
	var num = parseInt(accedo.memoryGame.mainPage.imageNode.getAttribute("id"));
	e = window.event || e;
		switch (e.keyCode) {
		// left button
		case 37:
			num--;
			if (num == 0) num = 3; 
			accedo.memoryGame.mainPage.imageNode = document.getElementById(num);
			accedo.memoryGame.mainPage.imageNode.border = 3; 
			accedo.memoryGame.mainPage.imageNode.style.borderColor = "#FFFF00";
			break; 
			
		case 39:
			num++; 
			if (num == 4) num = 1;
			accedo.memoryGame.mainPage.imageNode = document.getElementById(num);
			accedo.memoryGame.mainPage.imageNode.border = 3; 
			accedo.memoryGame.mainPage.imageNode.style.borderColor = "#FFFF00";		
			break;
			
		case 13:
			if (num == 1) {
				window.open('memory.html?username=boliang'); 
			} else if (num == 2) {
				window.open('achievement.html?username='); 
			} else if (num == 3) {
				window.open('hiscore.html');
			}
			break;
			
		default:
			break;
		}
};


accedo.memoryGame.mainPage = {
		
		imageNode : null
		
};